local skynet = require "skynet"

skynet.start(function()

	skynet.uniqueservice("protoloader")
	
	local debug_console_port = skynet.getenv("debug_console_port")
	if debug_console_port then
		debug_console_port = tonumber(debug_console_port)
		skynet.newservice("debug_console", debug_console_port)
	end

	local log = skynet.uniqueservice("log")

	if skynet.getenv("os") ~= "win32" then
		local httpsc = skynet.uniqueservice("httpsc")
	end

	local mysqls = skynet.uniqueservice "mysqlserver"
	local logind = skynet.uniqueservice "logind"
	local gameserver = skynet.uniqueservice("gameserver")

	local wsgate = skynet.uniqueservice("wsgate")
	skynet.call(wsgate, "lua", "start", {
		server = gameserver,
		maxclient = 1024
	})

	skynet.exit()
end)